package com.bjsdzk.collector.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class PublicUtils {
    private static Logger logger = LoggerFactory.getLogger(PublicUtils.class);

    public static void printException(Throwable e, Integer port) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(stream));
        String exception = stream.toString();
        logger.error("port:{}==>exception:{}",port,exception);
    }

    public static void printException(Throwable e) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(stream));
        String exception = stream.toString();
        logger.error("exception:{}",exception);
    }
}
